using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.RegularExpressions;

namespace DataModels.Models
{
    public partial class Facility : IComparable
    {
        [Key, Column(TypeName = "varchar")]
        [StringLength(50)]
        public string FacCode { get; set; }

        [StringLength(250)]
        [Required]
        public string FacName { get; set; }

        [StringLength(250)]
        public string InternalName { get; set; }

        [StringLength(250)]
        public string FacShortName { get; set; }

        [Column("Region")]
        public int RegionId { get; set; }

        [Column("District")]
        public int DistrictId { get; set; }

        public Nullable<decimal> Latitude { get; set; }

        public Nullable<decimal> Longitude { get; set; }

        [StringLength(10)]
        public string RegistryId { get; set; }

        [Column("FacilityType")]
        public int FacilityTypeId { get; set; }

        public Nullable<bool> Activated { get; set; }
        public Nullable<System.DateTime> CreateDate { get; set; }
        public Nullable<int> CreatedByUser { get; set; }
        public Nullable<System.DateTime> UpdateDate { get; set; }
        public Nullable<int> UpdatedByUser { get; set; }
        public int SupportingPartnerId { get; set; }

        public bool ProvideDBS { get; set; }
        public bool? ProvideRCH { get; set; }
        public bool? ProvidePMTCT { get; set; }
        public bool? ProvideTestingAndCounseling { get; set; }

        #region Obsolete Properties
        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<bool> PMTCT { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<bool> LD { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<int> PMTCTYear { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<int> PMTCTPeriod { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<int> LDYear { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<int> LDPeriod { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        [StringLength(1000)]
        public string Description { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        [StringLength(1000)]
        public string Address { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        [StringLength(1000)]
        public string PrincipalContact { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<int> Status { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        [StringLength(1000)]
        public string Remarks { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<System.DateTime> ANCStartDate { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<System.DateTime> LDStartDate { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<System.DateTime> HEIDStartDate { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<bool> ANC { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<bool> HEID { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<System.DateTime> PMTCTStartDate { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<bool> Prophylaxis { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<System.DateTime> ProphylaxisStartDate { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<System.DateTime> ActiveDate { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<System.DateTime> InactiveDate { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<bool> Trained { get; set; }

        [Obsolete("This property will be deleted soon!", true)]
        public Nullable<System.DateTime> DBSStartDate { get; set; }
        #endregion        

        #region Navigation and Relationship Properties
        //public virtual List<ANCForm> ANCForms { get; set; }
        //public virtual List<ANCForm_HudhurioLaKwanza> ANCForm_HudhurioLaKwanza { get; set; }
        //public virtual List<ANCForm_Malaria> ANCForm_Malaria { get; set; }
        //public virtual List<ANCForm_PMTCT> ANCForm_PMTCT { get; set; }
        //public virtual List<ANCForm_VidokezoVyaHatari> ANCForm_VidokezoVyaHatari { get; set; }

        [ForeignKey("DistrictId")]
        public virtual District District { get; set; }

        //public virtual AutoReminderFacility AutoReminderFacility { get; set; }
        
        //public virtual List<ExpectedReport> ExpectedReports { get; set; }

        [ForeignKey("FacilityTypeId")]
        public virtual FacilityType FacilityType { get; set; }
        
        public virtual SupportingPartner SupportingPartner { get; set; }
        //public virtual List<OtherSystemsFacilityDetail> OtherSystemsFacilityDetails { get; set; }
        //public virtual List<ReceivedSM> ReceivedSMS { get; set; }
        //public virtual List<SMSReminderTracker> SMSReminderTrackers { get; set; }
        //public virtual List<TestingAndCounselingData> TestingAndCounselingData { get; set; }
        //public virtual List<CDCTarget> Targets { get; set; }

        //public virtual List<LDForm> LDForms { get; set; }
        //public virtual List<LDForm_TaarifaYaWaliojifungua> LDForm_TaarifaYaWaliojifungua { get; set; }
        //public virtual List<LDForm_NjiaYaKujifungua> LDForm_NjiaYaKujifungua { get; set; }
        //public virtual List<LDForm_MatatizoKablaYaKujifungua> LDForm_MatatizoKablaYaKujifungua { get; set; }
        //public virtual List<LDForm_MatatizoBaadaYaKujifungua> LDForm_MatatizoBaadaYaKujifungua { get; set; }
        //public virtual List<LDForm_EmOC> LDForm_EmOC { get; set; }
        //public virtual List<LDForm_PMTCT> LDForm_PMTCT { get; set; }
        //public virtual List<LDForm_WatotoWaliozaliwaMmoja> LDForm_WatotoWaliozaliwaMmoja { get; set; }
        //public virtual List<LDForm_WatotoWaliozaliwaMapacha> LDForm_WatotoWaliozaliwaMapacha { get; set; }
        //public virtual List<LDForm_WatotoWaliosaidiwaKupumua> LDForm_WatotoWaliosaidiwaKupumua { get; set; }
        #endregion
        public int CompareTo(object obj)
        {
            if (obj == null) return 1;

            Facility otherFacility = obj as Facility;
            if (otherFacility != null) return this.FacName.CompareTo(otherFacility.FacName);
            else throw new ArgumentException("Object is not a Facility");
        }
    }
}
